function ShadingObj(pdObjs) {
	this.shadingID = null;
	this.matrix = null;
	
	this.shadingpattern = null;
	this.pdPage = null;
	this.BBox = [];
	this.position = [];
	this.nGenStateID = -1;
	this.nClrStateID = -1;
	this.nGraphStateID = -1;
	this.nTextStateID = -1;
	this.nClipPathStateID = -1;

	this.m_pdObjs = pdObjs;

	this.GetBBox = function (mtObj2Dev) {

	    var rect = mtObj2Dev.TransFormRect(this.position[0], this.position[1], this.position[2], this.position[3]);
	    for (var i = 0; i < 4; i++)
	        rect[i] = Math.round(rect[i]);
	    return rect;
	}
}

// set up prototype inheritance chain
setupInheritPrototype(ShadingObj, PageObj);

ShadingObj.prototype.ParseJson = function (arrayData) {
    //var shading = this;
    this.shadingID = arrayData[1];
    this.SetMatrix(stringArr2NumArr(arrayData[3]));
    this.shadingpattern = ShadingPattern.prototype.FromJson(arrayData[9]);
    this.nGraphStateID = arrayData[6];
    this.nClrStateID = arrayData[7];
    this.nTextStateID = arrayData[8];
    this.nGenStateID = arrayData[4];
    this.nClipPathStateID = arrayData[5];
    this.BBox = stringArr2NumArr(arrayData[2]);
    this.position = stringArr2NumArr(arrayData[2]);
};

ShadingObj.prototype.ParseFromBin = function(rd) {
//	var type = rd.readByte();
	this.shadingID = rd.readUint32();
	var mtxId = rd.readUint16();
	this.matrix = this.m_pdObjs.GetMatrixByID(mtxId);
	for (var i = 0; i < 4; i++) {
		this.BBox[i] = rd.readFloat32();
		this.position[i] = this.BBox[i];
	}
	this.shadingpattern = new ShadingPattern();
	this.shadingpattern.ParseFromBin(rd);
};
